import jsonp from 'common/js/jsonp'

import {ajaxCommonParams, jsonpCommonParams, jsonpOptions} from 'api/config'

export const testJsonp = () => {
  const url = 'https://c.y.qq.com/splcloud/fcgi-bin/p.fcg'

  const data = Object.assign(jsonpCommonParams, {jsonpCallback: 'jsonp1'})

  return jsonp(url, data, jsonpOptions)
}

export const getRecommend = () => {
  // const url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg'
  const url = 'musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg'

  const data = Object.assign(ajaxCommonParams, {
    uin: 0,
    platform: 'h5',
    needNewCode: 1
  })

  /* eslint-disable */
  return axios({method:'get',baseURL:'/api',url,data})
  // return axios.get(url,data)
}

export const getDiscList = () =>{
  const url = 'api/getDiscList'

  const data = Object.assign({},ajaxCommonParams,{
    platform: 'yqq',
    hostUin: 0,
    sin: 0,
    ein: 29,
    sortId: 5,
    needNewCode: 0,
    categoryId: 10000000,
    rnd: Math.random(),
    format: 'json'
  })

  return axios.get(url,{params:data}).then(res=>{
    return Promise.resolve(res)
  })
}
